package de.dailab.graphworld.ontology;

import de.dailab.jiactng.agentcore.comm.ICommunicationAddress;

/**
 * A wrapper for the task when an assignee is already been selected.
 *
 * @author Kseniya
 */
public class JobAssigned extends Job {

    public JobAssigned(ICommunicationAddress assignee, Proposal proposal) {
        super(proposal.getTask());
        setAssignee(assignee, proposal);
    }

    /**
     * Get the value of assignee
     *
     * @return the value of assignee
     */
    public final ICommunicationAddress getAssignee() {
        return candidates.isEmpty() ? null : iterator().next();
    }

    /**
     * Set the value of assignee
     *
     * @param assignee new value of assignee
     */
    public final void setAssignee(ICommunicationAddress assignee, Proposal proposal) {
        candidates.clear();
        addProposal(assignee, proposal);
    }
}
